<template>
	<view class="personalInfo  ">

		<view class="personalBox bgWhite radius8">

			<uv-form labelPosition="left" :model="personaModel"  :labelStyle="labelStyle"
				ref="form">
				<uv-form-item label="收款人" borderBottom prop="personaModel.name" labelWidth="140rpx">
					<uv-input inputAlign="right" v-model="personaModel.name" border="none" placeholder="请输入">
					</uv-input>
				</uv-form-item>
				<uv-form-item label="手机号" borderBottom prop="personaModel.name" labelWidth="140rpx">
					<uv-input inputAlign="right" v-model="personaModel.mobile" border="none" placeholder="请输入">
					</uv-input>
				</uv-form-item>
				<uv-form-item label="开户银行" borderBottom prop="personaModel.bank_name" labelWidth="140rpx">
					<uv-input inputAlign="right" v-model="personaModel.bank_name" border="none" placeholder="例如**市**区/县**大道**银行">
					</uv-input>
				</uv-form-item>
				<uv-form-item label="银行卡号"  prop="personaModel.bank_id" labelWidth="140rpx">
					<uv-input inputAlign="right" v-model="personaModel.bank_id" border="none" placeholder="请输入银行卡号">
					</uv-input>
				</uv-form-item>
				
			</uv-form>
		</view>
		<view class="xy align-center justify-center">
		<uv-checkbox-group v-model="checked">
			<uv-checkbox shape="circle" :customStyle="{
			'margin':'0 auto'
		}" activeColor="#49806F" name="apple" label="">
				<template #default>
					<view class="align-center justify-center ft13" style="color: #999;">
						我已阅读并接受<text @click.stop="toxy(3)" style="color: #49806F;">《推荐人协议》</text> 
					</view>
				</template>
		
			</uv-checkbox>
		</uv-checkbox-group>
		</view>
		<view class="save_btn" v-if="type!=2" @click="save">
			{{type=='0'?"审核中":"提交" }}
		</view>
		
	</view>
</template>

<script>
	import operate from '@/common/operate.js'
	export default {
		data() {
			return {
				labelStyle: {
					'height': '87rpx',
					'font-size': "30rpx",
					'color': '#000'
				},
				personaModel: {
					name: "",
					bank_name: '',
					bank_id: "",
					id:"",
					mobile:""
				
				},
				personalRules: {
					'name': {
						type: 'string',
						required: true,
						message: '请填写姓名',
						trigger: ['blur', 'change']
					},
					'idcode': {
						type: 'string',
						required: true,
						message: '请填写身份证号',
						trigger: ['blur', 'change']
					},
					'address': {
						type: 'string',
						required: true,
						message: '请填写地址',
						trigger: ['blur', 'change']
					},
					// 'personaModel.sfz1': {
					// 	type: 'string',
					// 	required: true,
					// 	message: '请上传身份证正反面照片',
					// 	trigger: ['blur', 'change']
					// },
					

				},
				areaRrand: [
					[],
					[]
				],
				columnData: [],
				area: "",
				checkboxValue: [],
				cateList: [],
				loading:false,
				type:"",
				checked: [],
			};
		},
		onReady() {
		},
		onLoad(opt) {
				
			this.$api.referrerinfo().then(res=>{
				
					
				if(res.data){
					this.personaModel=res.data
					this.type=res.data.tuijian_status
				}
				
			})
			
		},
		methods: {
				toxy(){
					uni.navigateTo({
						url:'/pages/abouts/index'
					})
				},
			async save() {
				if(this.type=='0')return
				if(!this.personaModel.name) return this.$utils.msg('请输入收款人')
				
					if(!this.$utils.checkStr(this.personaModel.mobile,'mobile')) return this.$utils.msg('请输入正确的手机号码')
				if(!this.personaModel.bank_name) return this.$utils.msg('请输入收款银行')
				if(!this.personaModel.bank_id) return this.$utils.msg('请输入银行卡号')
				if(!this.checked.length) return this.$utils.msg('请阅读并同意推荐人协议')
				if(this.loading)return
				this.loading=true
					this.$api.referrer({
						bank_id:this.personaModel.bank_id,
						id:this.personaModel.id,
						name:this.personaModel.name,
						bank_name:this.personaModel.bank_name,
						mobile:this.personaModel.mobile
					}).then(res=>{
						console.log(res)
						this.loading=false
						if(res.code==1){
							uni.showToast({
								title:res.msg,
								icon:'none'
							})
								
							setTimeout(()=>{
								uni.switchTab({
									url:'/pages/tabbar/mine'
								})
							},1000)
						}else{
							this.$utils.msg(res.msg)
						}
					})
			},


		}
	}
</script>
<style>
	page {
		background-color: #f5f5f5;
	}
</style>
<style lang="scss" scoped>
	.header {
		margin-top: 52rpx;
		margin-bottom: 40rpx;
		font-weight: 600;
		font-size: 36rpx;
		color: #000000;
		line-height: 36rpx;

	}

	.personalInfo {

		padding: 22rpx;
		position: relative;

		.personalBox {
			padding: 0 32rpx ;

		}

		.save_btn {
			width: 100%;
			height: 90rpx;
			margin-top: 38rpx;
			margin-bottom: 40rpx;
			background: #49806F;
			border-radius: 55rpx;
			font-size: 32rpx;
			color: #FFFFFF;
			text-align: center;
			line-height: 90rpx;
		}

	}

	button {
		color: #303133;
		font-size: 28rpx;
		text-align: left;
	}

	image {
		width: 300rpx;
		height: 250rpx;

	}

	.textbox {
		width: 300rpx;
		height: 51rpx;
		background: #DFC199;
		border-radius: 0 0 10rpx 10rpx;
		font-weight: 400;
		font-size: 23rpx;
		color: #FFFFFF;
		text-align: center;
		line-height: 51rpx;
		bottom: 0;
		left: 0;
	}
	.xy {
	
		position: fixed;
		bottom: 100rpx;
		left: 0;
		right: 0;
		margin: auto;
	
		text {}
	}
</style>